/**
 * 
 */
package com.pmsco.pms.core.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.pmsco.pms.core.dao.PmsRoleDao;
import com.pmsco.pms.core.domain.PmsRole;

/**
 * @author Long Tran
 *
 */
public class PmsRoleDaoImpl extends HibernateDaoSupport implements PmsRoleDao {
	
	public PmsRole getRole(PmsRole pmsRole) {
		PmsRole ret = new PmsRole();
		List<PmsRole> temp = getHibernateTemplate().findByExample(pmsRole);
		if(temp != null && temp.size() == 1)
			ret = temp.get(0);
		return ret;
	}
	
	public PmsRole getRoleById(Long id) {
		PmsRole ret = getHibernateTemplate().load(PmsRole.class, id);
		return ret;
	}
	
	public List<PmsRole> listPmsRole(PmsRole searchTemplate) {
		List<PmsRole> ret = new ArrayList<PmsRole>();
		ret = getHibernateTemplate().findByExample(searchTemplate);
		return ret;
	}
}
